import request from '@/utils/request'

// 获取所有部门树形结构
export function getDepartmentsAPI() {
  return request({
    url: '/company/department'
  })
}

// 添加新部门
export function addDepartmentsAPI(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 获取部门负责人
export function getEmployeeSimpleAPI() {
  return request({
    url: '/sys/user/simple'
  })
}

// 删除部门
export function delCompanyDepartmentAPI(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

// 数据回填
export function getCompanyDepartmentByIdAPI(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 编辑部门
export function editDeptAPI(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
